<template>
    <div class="index_main">
      <div class="phone_box">
        <div class="header_img">
          <img src="@/static/index_configuration/wallet_index.png" alt />
          <!-- <div class="search_box"></div> -->
        </div>
        <div class="notice_box" @click="noticeView">
            <div class="notice_box_l">公告</div>
            <div class="notice_box_r">{{noticeInfo.notice}}</div>
        </div>
        <img class="wallet_nav" src="@/static/index_configuration/wallet_nav.png" alt="">
        <div class="ph_main">
          <!-- 消费获积分 -->
          <div class="get_points">
            <div class="zzc_box">
                <el-button type="primary" icon="el-icon-edit" circle @click="getPointsView"></el-button>
            </div>
            <div class="get_points_t">
                <span style="font-size: 15px;color: #222222;font-weight: bold">消费获积分</span>
                <span>全网下单优惠多，笔笔消费送积分</span>
            </div>
            <div class="get_points_b">
                <div class="get_points_b_box" v-for="(item,index) in homePageNavigationInfo.navigationList" :key="index">
                    <img :src="item.iconUrl" alt="">
                    <div class="preview_box_txt" v-if="item.title!=''">{{item.title}}</div>
                </div>
                <div class="get_points_b_box">
                    <img src="@/static/index_configuration/more_icon.png" alt="">
                    <span>更多</span>
                </div>
            </div>
          </div>
          <!-- 通兑积分 -->
          <div class="redeem_points">
            <div class="zzc_box">
                <el-button type="primary" icon="el-icon-edit" circle></el-button>
            </div>
            <div class="redeem_points_t">
                <span style="font-size: 15px;color: #222222;font-weight: bold">通兑积分</span>
                <div class="redeem_points_t_r">
                    <img v-for="(item,index) in bannerList" :key="index" :src="item.iconUrl" alt="">
                </div>
            </div>
            <!-- 轮播图 -->
            <div class="all_play" @click="addBanner">
                <div class="all_play_banner_null" v-if="bannerList.length==0">点击添加轮播图</div>
                <div class="all_play_banner" v-if="bannerList.length>0">
                <el-carousel height="90px" indicator-position="outside" :interval="5000">
                    <el-carousel-item v-for="(item, index) in bannerList" :key="index + 'b'">
                        <img class="banner_img" :src="item.bannerUrl" alt />
                    </el-carousel-item>
                </el-carousel>
                </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 搜索配置 -->
      <searchDialog v-if="searchVisible" :id="id" :visible.sync="searchVisible"
      @success="_handleSuccess"></searchDialog>
      <!-- 公告配置 -->
      <noticeDialog v-if="noticeVisible" :id="id" :visible.sync="noticeVisible"
      @success="_handleSuccess"></noticeDialog>
      <!-- 消费获积分 -->
      <getPointsDialog v-if="getPointsVisible" :id="id" :visible.sync="getPointsVisible"
      @success="_handleSuccess"></getPointsDialog>
      <!-- 轮播图组件 -->
      <banner-diglog v-if="bannerDiglog" :id="id" :visible.sync="bannerDiglog"
        @success="_handleSuccess" />
    
    </div>
  </template>
  <script>
  import {
    homePageNotice,homePageNavigation,homePageExchange
  } from "@/api/incentiveManagement/adConfigNew";
  import bannerDiglog from "../components/points_wallet/bannerDiglog";
  import searchDialog from "../components/points_wallet/searchDialog";
  import noticeDialog from "../components/points_wallet/noticeDialog";
  import getPointsDialog from "../components/points_wallet/getPointsDialog";
  export default {
    name: "shopDetail",
    components: {
      bannerDiglog,searchDialog,noticeDialog,getPointsDialog
    },
    props: {},
    data() {
      return {
        bannerDiglog: false,
        id: "",
        searchVisible: false,//搜索配置弹窗
        noticeVisible: false,//公告配置弹窗
        getPointsVisible: false,//消费获积分弹窗
        noticeInfo:{},//公告详情
        homePageNavigationInfo: {},//消费获积分详情详情
        bannerList:[],//通兑积分详情
      };
    },
    watch: {},
    created() {
      this.getHomePageNotice();
      this.getHomePageNavigation();
      this.getHomePageExchange();
    },
    mounted() { },
    methods: {
      //获取公告
      getHomePageNotice() {
        var data = {}
        homePageNotice(data).then(res => {
            this.noticeInfo = res.result
        })
      },
      //获取消费获积分详情
      getHomePageNavigation(){
        var data = {}
        homePageNavigation(data).then(res => {
            this.homePageNavigationInfo = res.result
        })
      },
      //获取通兑积分详情
      getHomePageExchange() {
        const params = {};
        homePageExchange(params).then((res) => {
            this.bannerList = res.result
        });
      },
      //搜索配置弹窗
      searchView(){
        this.searchVisible = true
      },
      //公告配置弹窗
      noticeView(){
        this.noticeVisible = true
      },
      //消费获积分
      getPointsView(){
        this.getPointsVisible = true
      },
      //获取轮播图
      getbannerList() {
        bannerList(1).then((res) => {
          this.bannerList = res.result;
        });
      },
      
      //添加轮播图
      addBanner() {
        this.bannerDiglog = true;
      },
      _handleSuccess(){
        this.getHomePageNotice();
        this.getHomePageNavigation();
        this.getHomePageExchange();
      },
    },
  };
  </script>
  <style lang="scss" scoped>
  .phone_box {
    width: 395px;
    min-height: 800px;
    border-radius: 30px;
    border: 10px solid #333;
    margin: 40px 200px 0 100px;
    background: #f5f8fe;
    box-sizing: border-box;
    overflow: hidden;
  }
  
  .header_img {
    width: 100%;
    position: relative;
    .search_box{
        width: 120px;
        height: 30px;
        cursor: pointer;
        position: absolute;
        top: 50px;
        right: 130px;
        border-radius: 20px;
    }
    .search_box:hover{
        background-color: rgba(0, 0, 0, 0.6);
    }
    img {
      width: 100%;
      border-top-left-radius: 30px;
      border-top-right-radius: 30px;
    }
  }
  
  .notice_box{
    cursor: pointer;
    background-color: #FFFFFF;
    border-radius: 20px;
    color: #999999;
    width: 345px;
    height: 30px;
    padding-top: 4px;
    display: flex;
    align-items: center;
    margin: 6px auto 0px;
    .notice_box_l{
        font-size: 12px;
        font-weight: bold;
        border-right: 1px solid #999999;
        width: 48px;
        text-align: center;
    }
    .notice_box_r{
        flex: 1;
        white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
        font-size: 12px;
        padding-left: 10px;
    }
  }
  .notice_box:hover{
    background-color: #777171;
  }
  .wallet_nav{
    width: 100%;
  }
  .get_points{
    position: relative;
    background-color: #FFFFFF;
    border-radius: 8px;
    width: 345px;
    height: 140px;
    margin: 0 auto 20px;
    padding: 15px 15px 0;
    box-sizing: border-box;
    cursor: pointer;
    .zzc_box{
        width: 345px;
        height: 140px;
        border-radius: 8px;
        background: rgba(0, 0, 0, 0.6);
        position: absolute;
        top: 0;
        left: 0;
        z-index: 2;
        display: none;
        justify-content: center;
        align-items: center;
    }
    .get_points_t{
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 12px;
        color: #666666;
    }
    .get_points_b{
        display: flex;
        .get_points_b_box{
            width: 20%;
            display: flex;
            flex-direction: column;
            align-items: center;
            font-size: 13px;
            color: #2C2A2F;
            margin-top: 20px;
        }
        .get_points_b_box img{
            width: 36px;
            height: 36px;
            border-radius: 50%;
            margin-bottom: 10px;
            object-fit: cover;
        }
    }
  }
  .get_points:hover .zzc_box{
    display: flex;
  }
  .redeem_points{
    position: relative;
    background-color: #FFFFFF;
    border-radius: 8px;
    width: 345px;
    height: 140px;
    margin: 0 auto 20px;
    padding: 15px 15px 0;
    box-sizing: border-box;
    cursor: pointer;
    .zzc_box{
        width: 345px;
        height: 140px;
        border-radius: 8px;
        background: rgba(0, 0, 0, 0.6);
        position: absolute;
        top: 0;
        left: 0;
        z-index: 2;
        display: none;
        justify-content: center;
        align-items: center;
    }
    .redeem_points_t{
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 12px;
        color: #666666;
    }
    .redeem_points_t_r{
        display: flex;
    }
    .redeem_points_t_r img{
        width: 16px;
        height: 16px;
        border-radius: 50%;
        margin-left: 4px;
    }
  }
  .all_play {
    cursor: pointer;
    .all_play_nav {
      width: 100%;
      display: flex;
      align-items: center;
      overflow-x: hidden;
      white-space: nowrap;
      position: absolute;
      top: 46px;
      padding: 0 10px;
      box-sizing: border-box;
  
      .all_play_nav_box {
        height: 20px;
        border-radius: 100px;
        background: #ffffff;
        color: #333333;
        font-size: 12px;
        line-height: 20px;
        padding: 0 10px;
        margin-right: 20px;
      }
    }
    .all_play_banner_null{
      background-color:#eee;
      width: 315px;
      height: 76px;
      color: red;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 16px 0 0;
      border-radius: 6px;
    }
    .all_play_banner {
      // padding: 10px 10px 0;
      position: relative;
      border-radius: 16px;
  
      .all_play_banner_title {
        color: #FFFFFF;
        font-size: 15px;
        position: absolute;
        top: 8px;
      }
  
      .banner_img {
        position: absolute;
        top: 10px;
        left: 5px;
        width: 315px;
        height: 76px;
        // border-radius: 6px;
      }
  
      .all_play_banner_name {
        font-size: 15px;
        color: #ffffff;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        position: absolute;
        top: 190px;
        line-height: 24px;
        padding: 0 10px;
      }
  
      .box_detail_address {
        display: flex;
        align-items: center;
        padding-left: 20px;
        position: absolute;
        bottom: 6px;
        z-index: 2;
      }
  
      .box_detail_address_box {
        display: flex;
        align-items: center;
        font-size: 12px;
        color: #ffffff;
        margin-right: 32px;
      }
  
      .box_detail_address_box img {
        width: 16px;
        height: 16px;
        margin-right: 6px;
        margin-bottom: 2px;
      }
    }
  }
  .preview_box_txt{
    width: 36px;
    text-align: center;
    text-align: center;
    font-size: 12px;
    color: #2C2A2F;
    white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
    word-break: break-all;
  }
  
  </style>
  